package com.yf.arrayadapter;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		ListView lv_list = (ListView) findViewById(R.id.lv_list);
		// 当列表中的数据很简单，如仅一段文字，或一个图片加一段文字时，可以使用ArrayAdapter
		String[] obj = { "安琪拉", "小乔", "王昭君", "甄姬", "莫邪", "貂蝉" };
		// ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
		// R.layout.item, obj);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.item2, R.id.tv_text,
				obj);
		lv_list.setAdapter(adapter);
	}
}
